// function curry(fn, args = []) {
//     return (...innerArg) => (args.length === fn.length - 1 || !fn.length) ?
//     fn(...args, ...innerArg) : curry(fn, [...args, ...innerArg])
//  }
// var curry = fn =>
//     judge = (...args) =>
//         args.length === fn.length
//             ? fn(...args)
//             : (arg) => judge(...args, arg)

 function curry(fn,...args) {
    length = fn.length;
    args = args || [];
    if(args.length >= length){
        return fn.call(this,...args);
    }
    return function(...innerArg) {     
        var _args = args.slice(0)
        // if (_args.length < length) {
            return curry.call(this,fn,..._args,...innerArg);
        // }
    }
}
var fn = curry(function(a, b, c) {
    console.log([a, b, c]);
},'a');
fn('b','c')